﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'usp_UPDMS_REF_SHOP_Set_Favorite')
	BEGIN
		DROP Procedure usp_UPDMS_REF_SHOP_Set_Favorite
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : usp_UPDMS_REF_SHOP_Set_Favorite
**	Desc : 업소관리에서 즐겨찾기를 설정/해제 한다. (리스트에서)
**	Test Exec Query : Exec usp_UPDMS_REF_SHOP_Set_Favorite 10, 'smstyle'
**	Called by : Ref_Dac_UPDMS_REF_SHOP.cs
**	Program ID : Ref1010m
**	Auth : 송시명
**	Date : 2014-01-14
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**	
*******************************************************************************/
CREATE PROC [dbo].[usp_UPDMS_REF_SHOP_Set_Favorite]
@li_seq int,
@ls_user_id nvarchar(20)
AS
SET NOCOUNT OFF

UPDATE UPDMS_REF_SHOP
   SET Favorite_Yn = ( SELECT CASE (SELECT Favorite_Yn FROM UPDMS_REF_SHOP WITH(NOLOCK) WHERE Seq = @li_seq) WHEN 'Y' THEN 'N' ELSE 'Y' END Favorite_Yn ),
       Update_User = @ls_user_id,
       Update_Dt = GETDATE()
 WHERE Seq = @li_seq

GO